package com.mall.controller;

import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestMapping;

import com.mall.service.IUserService;

@Scope("prototype")
@Controller
@Transactional
public class IndexController {

	@Autowired 
	private JdbcTemplate jdbcTemplate;
	 
	@Autowired
	private IUserService userService;
	 
	@RequestMapping("/index")
	public String index(HttpServletRequest request){
		List<Map<String, Object>> list = jdbcTemplate.queryForList("select * from t_user ");
	    request.setAttribute("list", list);
	    String flag = userService.login("lsm", "123");
	    System.out.println("successFlag:"+flag);
		return "Index";
	}
	
}
